home *** CD-ROM | disk | FTP | other *** search
/ Magnum One / Magnum One (Mid-American Digital) (Disc Manufacturing).iso / d1 / marxmenu.arc / INST.MNU < prev    next >
Text File  |  1991-03-27  |  8KB  |  320 lines

  1. Comment
  2. =========================================================
  3.  
  4. MarxMenu installation Menu:
  5.  
  6. Copyright 1989-1991 by Marc Perkel * All rights reserved.
  7.  
  8. This is an example of how MarxMenu can be used as a job control
  9. language. There is quite an education in MarxMenu tricks here. If
  10. you want to write a similar program, this menu is worth studying.
  11.  
  12. =========================================================
  13. EndComment
  14.  
  15. Var
  16.   VertLine = "┬│││││││││││││││││││││││││││││││││││││││││││││"
  17.   EchoSt
  18.   FileLine
  19.   ProgName
  20.   NewDos
  21.   BatExit
  22.   EchoTail
  23.   ConfigSysPath
  24.   ConfigSysLines
  25.   WorkStr
  26.  
  27. Const
  28.   PauseTime = 100
  29.  
  30. DelFile 'MENUS.EXE'
  31.  
  32.  
  33. if ColorScreen
  34.    TextColor Cyan Blue
  35.    ClearScreen 176
  36.    GotoXY 1 25
  37.    TextColor Yellow Mag
  38.    ClearLine
  39.    WriteCenter 'MarxMenu Version ' MarxVersion ' * Copyright 1989-91 by Marc Perkel'
  40.    BoxBorderColor White Brown
  41.    BoxInsideColor Yellow Brown
  42.    BoxHeaderColor Yellow Mag
  43.    ClockColor Yellow Brown
  44.    TextColor Yellow Brown
  45. else
  46.    ClearScreen 176
  47.    TextColor Black Grey
  48.    GotoXY 1 25
  49.    ClearLine
  50.    WriteCenter 'Copyright 1989 by Marc Perkel * All Rights Reserved'
  51.    BoxBorderColor Black Grey
  52.    BoxInsideColor Black Grey
  53.    BoxHeaderColor Black Grey
  54.    ClockColor Black Grey
  55. endif
  56.  
  57. SingleLineBox
  58. Explode Off
  59. DrawBox 1 1 80 3
  60. GotoXY (54,1)
  61. Write "MarxMenu Installation"
  62. ClockPos 3 2
  63.  
  64. BlankTime = 10
  65. ScrollMove Off
  66.  
  67. Explode On
  68. Shadow Off
  69. BlockBox
  70. InverseColor Yellow Red
  71.  
  72. BoxBorderColor Yellow Mag
  73. BoxInsideColor Mag Mag
  74. DrawBox 10 6 61 17
  75. BoxBorderColor LGreen Blue
  76. BoxInsideColor Yellow Blue
  77. Shadow On
  78.  
  79. DrawBox 35 13 11 3
  80. WriteCenter 'The'
  81. Loop 5
  82.    MoveWindow -4 -1
  83.    Wait 3
  84. EndLoop
  85.  
  86. DrawBox 35 13 11 3
  87. WriteCenter 'Marx'
  88. Loop 5
  89.    MoveWindow 4 -1
  90.    Wait 3
  91. EndLoop
  92.  
  93. DrawBox 35 13 11 3
  94. WriteCenter 'Menu'
  95. Loop 5
  96.    MoveWindow -4 1
  97.    Wait 3
  98. EndLoop
  99.  
  100. DrawBox 35 13 11 3
  101. WriteCenter 'System'
  102. Loop 5
  103.    MoveWindow 4 1
  104.    Wait 3
  105. EndLoop
  106.  
  107. Wait 20
  108. DrawBox 25 13 31 3
  109. WriteCenter 'Installation Menu'
  110. Wait 250
  111. RollWindow 4
  112. EraseTopWindow
  113. Wait 20
  114. RollWindow 3
  115. EraseTopWindow
  116. Wait 20
  117. RollWindow 2
  118. EraseTopWindow
  119. Wait 20
  120. RollWindow 1
  121. EraseTopWindow
  122. Wait 20
  123. EraseTopWindow
  124.  
  125. Shadow Off
  126. DrawBox 25 11 31 7
  127.  
  128. NewDos = DosVersionString >= '3.30'
  129.  
  130.  
  131.  
  132. ;MXECHO is a debugging environment variable. Use SET MXMENU=OFF for
  133. ;normal use. SET MXECHO=ON to watch the MARX.BAT run.
  134.  
  135. If ReadEnv('MXECHO') > ''
  136.   EchoTail = '%MXECHO%'
  137. Else
  138.   EchoTail = 'OFF'
  139. EndIf
  140.  
  141. if NewDos
  142.    EchoSt = '@ECHO ' + EchoTail
  143. else
  144.    EchoSt = 'ECHO ' EchoTail
  145. endif
  146.  
  147.  
  148. ProgName = CleanFileName(Path + '\MARXMENU.EXE')
  149.  
  150. Write ' Creating MARX.BAT ... '
  151.  
  152. ;----- BatExit is a 0k bat file used to exit batch files
  153.  
  154. FileAssign (BatExit,'BATEXIT.BAT')
  155. FileCreate BatExit
  156. FileClose  BatExit
  157.  
  158. FileLine[1]  = EchoSt
  159. FileLine[2]  = ProgName + ' %1 ' + Path
  160. FileLine[3]  = '%MXCMD%'
  161. FileLine[4]  = '%0 %1'
  162.  
  163. FileLine[6]  = '*-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*'
  164.  
  165. FileLine[8]  = 'MarxMenu * CopyRight 1989-91 by Marc Perkel'
  166.  
  167. FileLine[10] = 'If you are having trouble getting MarxMenu to work,'
  168. FileLine[11] = 'the first line of this file can be changed to ECHO ON.'
  169.  
  170. FileLine[13] = 'MarxMenu controls this batch file by writing to the environment'
  171. FileLine[14] = 'variable MXCMD. %0 = MARX.BAT and restarts this batch file.'
  172.  
  173. FileLine[16] = 'MXSTOP.BAT is executed to exit this batch file.'
  174. FileLine[17] = 'The third parameter in line 2 is the directory where temporary'
  175. FileLine[18] = 'batch files are created.'
  176.  
  177. FileLine[20] = '*-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*'
  178.  
  179. FileLine[22] = '         MARX.BAT'
  180. FileLine[23] = '         --------     +-------MarxMenu Creates--+'
  181. FileLine[24] = '  +----> @ECHO OFF    |                         |'
  182. FileLine[25] = '  |      C:\MARX\MARXMENU.EXE %1 C:\MARX        |'
  183. FileLine[26] = '  |      %MXCMD% ->---+                         +-> $MX00000.BAT'
  184. FileLine[27] = '  | +--> %0 %1 --+    |                             ------------'
  185. FileLine[28] = '  | |            |    +---------------------------> CD\WORDSTAR'
  186. FileLine[29] = '  +-|------<-----+                                  WS --+'
  187. FileLine[30] = '    |                                                    |'
  188. FileLine[31] = '    +--------------------------------------------------<-+'
  189.  
  190. FileLine[33] = 'Note: MarxMenu sets MXCMD = CALL $MX00000.BAT'
  191.  
  192. FileLine[35] = '*-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*'
  193.  
  194. WriteTextFile 'MARX.BAT' FileLine
  195. Dispose FileLine
  196.  
  197. Writeln
  198. Write ' Creating DROPTO.BAT ... '
  199.  
  200. FileLine[1]  = 'DEL %1'
  201. FileLine[2]  = 'SET KSV='
  202. FileLine[3]  = 'SET MXCMD='
  203. FileLine[4]  = '%2 %3 %4 %5 %6 %7 %8 %9'
  204. FileLine[5]  = 'BATEXIT'
  205.  
  206. FileLine[7]  = '*-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*'
  207.  
  208. FileLine[9]  = 'DropTo is used when you want to eliminate the temporary batch'
  209. FileLine[10] = 'file created by MarxMenu. This is useful if you shell to DOS'
  210. FileLine[11] = 'and then run MarxMenu from the dos shell. It avoids the'
  211. FileLine[12] = '"Missing Batch File" error.'
  212.  
  213. FileLine[14] = 'DropTo is run from within the temporary batch file you want'
  214. FileLine[15] = 'to eliminate.
  215.  
  216. FileLine[17] = 'Usage: DROPTO %0 <command line>'
  217.  
  218. FileLine[19] = "Here's how it works:"
  219.  
  220. FileLine[21] = '     $MX00000.BAT <------deletes this file--------+'
  221. FileLine[22] = '     ------------                                 |'
  222. FileLine[23] = '     DROPTO %0 COMMAND.COM ------------> DEL %1 >-+'
  223. FileLine[24] = '                                         SET KSV='
  224. FileLine[25] = '                                         SET MXCMD='
  225. FileLine[26] = '              %2 executes command.com--> %2 %3 %4 %5 %6 %7 %8 %9'
  226.  
  227. FileLine[28] = '*-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*'
  228.  
  229. WriteTextFile 'DROPTO.BAT' FileLine
  230. Dispose FileLine
  231.  
  232. Writeln
  233. Write ' Creating MXSTOP.BAT ... '
  234.  
  235. FileLine[1] = 'SET MXCMD='
  236. FileLine[2] = 'SET KSV='
  237. FileLine[3] = 'REM From here, you control the menu exit process!'
  238.  
  239. WriteTextFile 'MXSTOP.BAT' FileLine
  240. Dispose FileLine
  241.  
  242. Writeln
  243. Write ' Creating GOFILE.BAT ... '
  244.  
  245. FileLine[1] = EchoSt
  246. FileLine[2] = 'MARXMENU GOFILE %1'
  247. FileLine[3] = 'REM This batch file is used only with the GOFILE menu.'
  248.  
  249. WriteTextFile 'GOFILE.BAT' FileLine
  250.  
  251. Writeln
  252. Wait PauseTime
  253. EraseTopWindow
  254.  
  255. CheckEnvSize
  256.  
  257. EraseTopWindow
  258. BoxBorderColor Yellow Mag
  259. BoxInsideColor White Mag
  260. DrawBox 18 10 44 7
  261. BoxBorderColor LGreen Blue
  262. BoxInsideColor Yellow Blue
  263. DrawBox 23 12 34 3
  264. WriteCenter 'MarxMenu Installed!'
  265. Wait PauseTime * 2
  266. EraseTopWindow
  267. EraseTopWindow
  268.  
  269. ExitMenu
  270.  
  271. ;--- Menu Exits Here
  272.  
  273. ;===================== Procedures ========================
  274.  
  275. ;--- Check the environment size
  276.  
  277. Procedure CheckEnvSize
  278. var NeededSpace ShellCommand
  279.    if EnvFree < 150
  280.       ConfigSysPath = ExistOnPath( 'CONFIG.SYS' )
  281.       NeededSpace = (EnvFree + 160) / 16 * 16
  282.       if DosVersionString < '3.30'
  283.          ShellCommand = Str(NeededSpace / 16)
  284.       else
  285.          ShellCommand = Str(NeededSpace)
  286.       endif
  287.       if ConfigSysPath <> ''
  288.          BoxBorderColor LCyan Blue
  289.          BoxInsideColor White Blue
  290.          DrawBox 15 8 51 13
  291.          WriteCenter '* Warning! *'
  292.          Writeln char(7)
  293.          Writeln '  You have a total of ' EnvSize ' bytes of environment'
  294.          Writeln '  space with only ' EnvFree ' bytes free. MarxMenu'
  295.          Writeln '  requires about 150 bytes of free environment'
  296.          Writeln '  space. You should modify you CONFIG.SYS file'
  297.          Writeln '  as follows:'
  298.          Writeln
  299.          WriteCenter 'SHELL=COMMAND.COM /P /E:' ShellCommand
  300.          Writeln
  301.          Writeln
  302.          WriteCenter( ' * Press any Key to Continue * ' )
  303.          Cursor Off
  304.          LastKey = ReadKey
  305.          EraseTopWindow
  306.       else
  307.          ReadTextFile( ConfigSysPath,ConfigSysLines )
  308.          Loop( NumberOfElements( ConfigSysLines ) )
  309.            WorkStr = UpperCase( ConfigSysLines[LoopIndex] )
  310.            If ( NextWord( WorkStr ) = 'SHELL' )
  311.              Delete( ConfigSysLines,LoopIndex,1 )
  312.            EndIf
  313.          EndLoop
  314.          ConfigSysLines[NumberOfElements( ConfigSysLines ) + 1] =
  315.          'SHELL=COMMAND.COM /P /E:' + ShellCommand
  316.          WriteTextFile( ConfigSysPath,ConfigSysLines )
  317.       endIf
  318.    endIf
  319. EndProc
  320.